package com.cse.service;

import org.apache.log4j.nt.NTEventLogAppender;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.cse.core.Product;
import com.cse.dao.BaseDao;

public class BaseServiceImp implements BaseService{
	
	private BaseDao baseDao;

	public BaseDao getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(BaseDao baseDao) {
		this.baseDao = baseDao;
	}

	public int addProduct(Product product) {
		// TODO Auto-generated method stub
		return baseDao.addProduct(product);
		
	}

	public Product getProduct(int id) {
		// TODO Auto-generated method stub
		return baseDao.getProduct(id);
	}
	
	public static void main(String[] args){
		ApplicationContext ctx	= new  ClassPathXmlApplicationContext("/spring-conf.xml");
		BaseService service = (BaseService) ctx.getBean("baseService");
		Product product = new Product();
		product.setBrand("sanxing");
		product.setCategory("phone");
		product.setContent("xxxxx");
		product.setImageURI("aaa");
		product.setOriginalUrl("aaaaaaaaa");
		product.setPrice("aa");
		product.setUpdatedtime("aa");
		int i = service.addProduct(product);
		System.out.println(i);
	}

}
